package lumis.service.navigation;

import lumis.doui.processaction.ProcessActionHandler;
import lumis.doui.source.TabularSource;
import lumis.doui.source.field.ITabularSourceField;
import lumis.portal.PortalException;
import lumis.portal.manager.ManagerFactory;
import lumis.portal.serviceinterfaceinstance.IServiceInterfaceInstanceManager;

/**
 * Saves bread crumb properties for a bread crumb interface instance 
 *
 * @version $Revision: 7370 $ $Date: 2007-06-12 13:50:49 -0300 (Tue, 12 Jun 2007) $
 * @since 4.0.11
 */
public class BreadCrumbPropertiesProcessActionHandler extends ProcessActionHandler<TabularSource<ITabularSourceField>>
{
	public void processAction() throws PortalException
	{
		Boolean includeHiddenChannels = getParameter("includeHiddenChannels", Boolean.class); 
		String callerInterfaceInstanceId = douiContext.getRequest().getCallerServiceInterfaceInstanceId();
		IServiceInterfaceInstanceManager serviceInterfaceInstanceManager = ManagerFactory.getServiceInterfaceInstanceManager();
		if (includeHiddenChannels.booleanValue())
			serviceInterfaceInstanceManager.setCustomProperty(sessionConfig, callerInterfaceInstanceId, BreadCrumbPropertiesDataProvider.SERVICE_INTERFACE_INSTANCE_PROPERTY_INCLUDE_HIDDEN_CHANNEL, includeHiddenChannels.toString(), transaction);
		else
			serviceInterfaceInstanceManager.deleteCustomProperty(sessionConfig, callerInterfaceInstanceId, BreadCrumbPropertiesDataProvider.SERVICE_INTERFACE_INSTANCE_PROPERTY_INCLUDE_HIDDEN_CHANNEL, transaction);
		addDefaultResponse();
	}
}
